package main.java.memento.white_box;

/**
 * 游戏角色类（发起人角色）
 */
public class GameRole {
    private int vit;
    private int atk;
    private int def;

    public void initState() {
        this.vit = 100;
        this.atk = 100;
        this.def = 100;
    }

    public void fight() {
        this.vit = 0;
        this.atk = 0;
        this.def = 0;
    }

    public RoleStateMemento saveState() {
        return new RoleStateMemento(vit, atk, def);
    }

    public void recoverState(RoleStateMemento roleStateMemento) {
        setAtk(roleStateMemento.getAtk());
        setDef(roleStateMemento.getDef());
        setVit(roleStateMemento.getVit());
    }

    public void stateDisplay() {
        System.out.println("血量" + getVit());
        System.out.println("攻击力" + getAtk());
        System.out.println("防御力" + getDef());
    }

    public void setVit(int vit) {
        this.vit = vit;
    }

    public void setAtk(int atk) {
        this.atk = atk;
    }

    public void setDef(int def) {
        this.def = def;
    }

    public int getVit() {
        return vit;
    }

    public int getAtk() {
        return atk;
    }

    public int getDef() {
        return def;
    }
}
